//
//  IManager+PortList.m
//  RocketProject
//
//  Created by chen jiedan on 13-11-26.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+PortList.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "IDataProvider.h"
#import "RCPortListDataModel.h"

@implementation IManager (PortList)


- (int64_t) requestTrainPortListForDelegate:(id<IManagerDelegate>)delegate
{
    NSString *urlSuffix = [NSString stringWithFormat:kTrainPortListPrefix];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCPortListDataModel class]
                                                     withDataDelegate:delegate];
}

- (int64_t) requestAirPortListForDelegate:(id<IManagerDelegate>)delegate
{
    NSString *urlSuffix = [NSString stringWithFormat:kAirPortListPrefix];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCPortListDataModel class]
                                                     withDataDelegate:delegate];
}
@end
